/*
 *  shnode_color.h
 *  shaderz_v3
 *
 *  Created by Anjali on 4/14/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef __SHADERZ_COLOR_NODE_H__
#define __SHADERZ_COLOR_NODE_H__

#include <string>

#include "shdefs.h"
#include "shnode.h"

namespace shaderz
{
	class shNodeColor : public shNode
	{
	public:
		shNodeColor( const std::string& InNodeName, float InRed, float InGreen, float InBlue, float InAlpha );
		void setRed( float InNewVal )	{ mRedStub->value.constant1Vec = InNewVal;		mRGBAStub->value.constant4Vec[0] = InNewVal; }
		void setGreen( float InNewVal )	{ mGreenStub->value.constant1Vec = InNewVal;	mRGBAStub->value.constant4Vec[1] = InNewVal; }
		void setBlue( float InNewVal )	{ mBlueStub->value.constant1Vec = InNewVal;		mRGBAStub->value.constant4Vec[2] = InNewVal; }
		void setAlpha( float InNewVal)	{ mAlphaStub->value.constant1Vec = InNewVal;	mRGBAStub->value.constant4Vec[3] = InNewVal; }
		
		float* rgba()	const { return mRGBAStub->value.constant4Vec; }
		float red()		const { return mRedStub->value.constant1Vec; }
		float blue()	const { return mBlueStub->value.constant1Vec; }
		float green()	const { return mGreenStub->value.constant1Vec; }
		float alpha()	const { return mAlphaStub->value.constant1Vec; }
		
	protected:
		// the output stubs cache
		linkStub*	mRGBAStub;
		linkStub*	mRedStub;
		linkStub*	mGreenStub;
		linkStub*	mBlueStub;
		linkStub*	mAlphaStub;
	
	private:
		typedef shNode	ParentClass;
	};
}

#endif